<?php
/**
 * Peizhi 插件
 * @author 后盾向军 <houdunwangxj@gmail.com>
 */

class AdminController extends AddonController {

    public function index() {
    	if(IS_POST){
    		$config = $_POST;
    		foreach ($config as $key => $value) {
    		
    			$data['value']=$value;
    				
    			M('peizhi')->data($data)->where(array('name'=>$key))->save();
    		}
    		$this->success('设置成功');
    		

    	}else{
    	$config = M('peizhi')->all();
    	$peizhi = array();
    	foreach ($config as $key => $value) {
    		$peizhi[$value['name']]=$value['value'];
    	}

    	$this->assign('peizhi',$peizhi);
        $this->display();
    	}
    	
    }

    
}